package com.we823.cms.repository.service.beetl.tag;

import java.util.List;

import com.github.pagehelper.PageInfo;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.we823.cms.model.extension.CaseCategory;
import com.we823.cms.repository.service.extension.CaseCategoryService;

import javax.annotation.Resource;

@Service("cms_case_categories")
@Scope("prototype")
public class CaseCategoryListTag extends AbstractListTag {

	private @Resource CaseCategoryService caseCategoryService;
	
	@Override
	public void execute() {
		List<CaseCategory> caseCategoryModels = null;
		if(pageRequest==null){
			caseCategoryModels = caseCategoryService.findAll(sort);
		}else{
			PageInfo<CaseCategory> caseCategoryPage = caseCategoryService.findAll(pageRequest);
			if(caseCategoryPage!=null){
				caseCategoryModels = caseCategoryPage.getList();
			}
		}
		
		this.binds(caseCategoryModels);
	}
}
